package com.zjc.yohoshop.mvp.view.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zjc.yohoshop.R;
import com.zjc.yohoshop.bean.GoodsListEntity;
import com.zjc.yohoshop.network.API;

public class ShopDetailsAdapter extends BaseQuickAdapter<GoodsListEntity.ValuesBean, BaseViewHolder> {
    public ShopDetailsAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, GoodsListEntity.ValuesBean item) {
        Glide.with(helper.itemView.getContext()).load(API.BaseUrl + item.goods_img_path)
                //禁用磁盘缓存
                .diskCacheStrategy( DiskCacheStrategy.NONE)
                //跳过内存缓存
                .skipMemoryCache(true)
                .into((ImageView) helper.getView(R.id.iv_item_shop_details_goods_img_path));
        helper.setText(R.id.tv_item_shop_details_goods_name, item.goods_name);
        helper.setText(R.id.tv_item_shop_details_goods_discount_price, "￥ " + item.goods_discount_price);
        helper.setText(R.id.tv_item_shop_details_goods_original_price, "￥ " + item.goods_original_price);
    }
}
